using System;
using System.Collections.Generic;
using System.Text;
using Shc.Sql;
using Shc.Json;
namespace CLZ.Data
{
	public static class TableHomeProduct
	{
		public const string Table = "HomeProduct";
		public const string HomeProductId = "HomeProductId";
		public const string VegetablesID = "VegetablesID";
		public const string BusinessID = "BusinessID";
		public const string HomeProductType = "HomeProductType";
		public const string NowOriginalPrice = "NowOriginalPrice";
		public const string NowSalesGuidePrice = "NowSalesGuidePrice";
		public const string SetDate = "SetDate";
	}
	
	[Serializable]
	public class BaseHomeProduct
		: IDbSessionEntity, IJsonClass
	{
		int m_HomeProductId;
		/// <summary>
        /// 
        /// </summary>
        public int HomeProductId
        {
            get { return m_HomeProductId; }
            set { m_HomeProductId = value; }
        }
		
		int? m_VegetablesID;
		/// <summary>
        /// 蔬菜信息表ID
        /// </summary>
        public int? VegetablesID
        {
            get { return m_VegetablesID; }
            set { m_VegetablesID = value; }
        }
		
		int? m_BusinessID;
		/// <summary>
        /// 经营户表ID
        /// </summary>
        public int? BusinessID
        {
            get { return m_BusinessID; }
            set { m_BusinessID = value; }
        }
		
		int? m_HomeProductType;
		/// <summary>
        /// 
        /// </summary>
        public int? HomeProductType
        {
            get { return m_HomeProductType; }
            set { m_HomeProductType = value; }
        }
		
		double m_NowOriginalPrice;
		/// <summary>
        /// 
        /// </summary>
        public double NowOriginalPrice
        {
            get { return m_NowOriginalPrice; }
            set { m_NowOriginalPrice = value; }
        }
		
		double m_NowSalesGuidePrice;
		/// <summary>
        /// 
        /// </summary>
        public double NowSalesGuidePrice
        {
            get { return m_NowSalesGuidePrice; }
            set { m_NowSalesGuidePrice = value; }
        }
		
		DateTime m_SetDate;
		/// <summary>
        /// 
        /// </summary>
        public DateTime SetDate
        {
            get { return m_SetDate; }
            set { m_SetDate = value; }
        }
		
		
		#region IDbSessionEntity Members
		public void ReadDBData(RowDataReader reader)
        {
            m_HomeProductId = reader[TableHomeProduct.HomeProductId];
            m_VegetablesID = reader[TableHomeProduct.VegetablesID];
            m_BusinessID = reader[TableHomeProduct.BusinessID];
            m_HomeProductType = reader[TableHomeProduct.HomeProductType];
            m_NowOriginalPrice = reader[TableHomeProduct.NowOriginalPrice];
            m_NowSalesGuidePrice = reader[TableHomeProduct.NowSalesGuidePrice];
            m_SetDate = reader[TableHomeProduct.SetDate];
        }
		
		public void WriteDBData(RowDataWriter writer)
        {
            writer.SetPrimaryKey(TableHomeProduct.HomeProductId, PrimaryKeyType.Identity, HomeProductId);
			writer[TableHomeProduct.VegetablesID] = VegetablesID;
			writer[TableHomeProduct.BusinessID] = BusinessID;
			writer[TableHomeProduct.HomeProductType] = HomeProductType;
			writer[TableHomeProduct.NowOriginalPrice] = NowOriginalPrice;
			writer[TableHomeProduct.NowSalesGuidePrice] = NowSalesGuidePrice;
			writer[TableHomeProduct.SetDate] = SetDate;
        }

        public void SetIdentityAfterInsert(DBObject idd)
        {
            m_HomeProductId = idd;
        }
		
		public string TableName
        {
            get { return TableHomeProduct.Table; }
        }
		#endregion
		
		#region IJsonClass Members

        public void JsonDeSerializeObj(JsonHashTable hashToRead)
        {
             m_HomeProductId = hashToRead["HomeProductId"];
			 
             m_VegetablesID = hashToRead["VegetablesID"];
			 
             m_BusinessID = hashToRead["BusinessID"];
			 
             m_HomeProductType = hashToRead["HomeProductType"];
			 
             m_NowOriginalPrice = hashToRead["NowOriginalPrice"];
			 
             m_NowSalesGuidePrice = hashToRead["NowSalesGuidePrice"];
			 
             m_SetDate = hashToRead["SetDate"];
			 
        }

        public void JsonSerializeObj(JsonHashTable hashToFill)
        {
            hashToFill["HomeProductId"] = HomeProductId;
			 
            hashToFill["VegetablesID"] = VegetablesID;
			 
            hashToFill["BusinessID"] = BusinessID;
			 
            hashToFill["HomeProductType"] = HomeProductType;
			 
            hashToFill["NowOriginalPrice"] = NowOriginalPrice;
			 
            hashToFill["NowSalesGuidePrice"] = NowSalesGuidePrice;
			 
            hashToFill["SetDate"] = SetDate;
			 
        }

        #endregion
		
	}
}
